import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;


public class Test {
	public static void main(String[] args) throws ClassNotFoundException, SQLException {
		Connection conn = null;
		  Class.forName("oracle.jdbc.driver.OracleDriver");
		   
		  String url = "jdbc:oracle:thin:@192.168.52.84:1521:ora10g";
		  conn = DriverManager.getConnection(url, "hstest", "hstest123");
		  System.out.println(conn);
		  PreparedStatement statement = conn.prepareStatement("SELECT * FROM tyebaccobank t WHERE t.vc_tradeacco = '00999000001773711'");
		  ResultSet resultSet = statement.executeQuery();
		  String cunstname = "";
		  while (resultSet.next()){
			  cunstname = resultSet.getString("vc_nameinbank");
			  System.out.println(cunstname);
		  }
		  String sql ="insert into tyebaccoinfo (VC_TRADEACCO, VC_CUSTNO, VC_PARTNERACCO, VC_PARTNERID, C_IDENTITYTYPE, VC_IDENTITYNO, VC_CUSTOMNAME, C_CUSTTYPE, C_SEX, VC_ZIP, VC_ADDRESS, VC_MOBILENO, VC_FAXNO, VC_EMAIL, VC_PHONE, VC_OFFICETEL, C_VOCATION, C_EDUCATION, C_MARRIAGE, VC_BIRTHDAY, VC_IDVALIDATE, VC_NATIONALITY, VC_OPENDATE, VC_INSTREPRNAME, C_INSTREPRTYPE, VC_INSTREPRNO, VC_INSTREPRVALIDATE, VC_CONTACT, C_CONTTYPE, VC_CONTNO, VC_CONTMOBILENO, VC_CONTVALIDATE, VC_ORGANIZATIONNO, VC_TAXNO, VC_ORGHOLDINGNAME, C_FROZENTYPE, VC_ORNOVALIDATE, VC_BUSINESSRANGE, C_HOLDINGTYPE, C_HOLDINGIDTYPE, VC_HOLDINGIDNO, VC_HOLDINGIDVALIDATE, C_USERMARK, C_BANKNO, VC_BANKACCO, C_CAPITALMODE, C_STATE, VC_BANKNAME, VC_CDCARD, VC_NAMEINBANK, VC_SALERCODE, VC_PARTNERACUSTNO, C_ISSALARY, VC_FACTORYNAME)\n" +
"values ('00199000001773712', '660001698562', '1046215697600006736683', 'BOCDS', '0', '421083199410216412', '"+cunstname+"', '1', null, null, null, '18674069410', null, null, null, null, null, null, null, null, '99991231', null, '20160705', null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, '004', '6215697600006736683', null, '1', '中国银行', null, '"+cunstname+"', null, null, null, null)";;
		PreparedStatement st = conn.prepareStatement(sql );
		boolean execute = st.execute();
		System.out.println(execute);
	}
}
